//  this library.
import 'package:flutter/material.dart';
import 'package:hktk_app/util/view_util.dart';

/// 我的页面tabbar 指示器
class MyTabBarDecoration extends Decoration {
  @override
  BoxPainter createBoxPainter([VoidCallback? onChanged]) {
    return _MyTabBarPainter();
  }
}

class _MyTabBarPainter extends BoxPainter {
  @override
  void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {
    var size = configuration.size!;

    // 起始坐标
    double startX = offset.dx + size.width / 2 - 32;
    double startY = offset.dy + size.height;

    // 画笔
    Paint paint = Paint()
      ..color = colorBlue1
      ..strokeWidth = 6
      ..strokeCap = StrokeCap.round;

    // 画线
    Offset p1 = Offset(startX, startY);
    Offset p2 = Offset(startX + 64, startY);
    canvas.drawLine(p1, p2, paint);
  }
}
